*------------- Upper-Body Strength and Political Egalitarianism: Twelve Conceptual Replications ------------------------------------*
*----------------------------------------------------- STUDY 3 ---------------------------------------------------------------------*

*** Background variables 
* Sex
clonevar sex = qa

* Age
clonevar age = qb

* Education 
generate education = .
replace education = 1 if qe == 1
replace education = 1 if qe == 2
replace education = 2 if qe == 3
replace education = 3 if qe == 4
replace education = 4 if qe == 5
replace education = 5 if qe == 6

label define educationLB 1 "Primary school or High school" 2 "Basic Vocational school" 3 "Secondary school" 4 "Bachelor's Degree" 5 "Master degree/Science degree and Doctorate"
label values education educationLB


* Social Dominance Orientation (large value = higher in SDO)
pwcorr q1_1 q1_2 q1_3 q1_4 q1_5 q1_6 q1_7 q1_8, sig
recode q1_3 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q1_4 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q1_7 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q1_8 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
alpha q1_1 q1_2 q1_3 q1_4 q1_5 q1_6 q1_7 q1_8
egen SDO = rowmean(q1_1 q1_2 q1_3 q1_4 q1_5 q1_6 q1_7 q1_8)


* Recodes SDO variable to a 0-1 scale for observed min and max within males and females
summ SDO if sex == 1
generate sdo = (SDO-(r(min)))/(r(max)-r(min)) if sex == 1

summ SDO if sex == 2
replace sdo = (SDO-(r(min)))/(r(max)-r(min)) if sex == 2


* Descriptives for SDO for males and females
alpha q1_1 q1_2 q1_3 q1_4 q1_5 q1_6 q1_7 q1_8
bys sex: summ sdo



** Sub-Dimensions of SDO:
* SDO-D
egen SDO_D = rowmean(q1_1 q1_2 q1_3 q1_4)
summ SDO_D if sex == 1
generate sdo_d = (SDO_D-(r(min)))/(r(max)-r(min)) if sex == 1

summ SDO_D if sex == 2
replace sdo_d = (SDO_D-(r(min)))/(r(max)-r(min)) if sex == 2

* SDO-E
egen SDO_E = rowmean(q1_5 q1_6 q1_7 q1_8)
summ SDO_E if sex == 1
generate sdo_e = (SDO_E-(r(min)))/(r(max)-r(min)) if sex == 1

summ SDO_E if sex == 2
replace sdo_e = (SDO_E-(r(min)))/(r(max)-r(min)) if sex == 2


* Descriptives for SDO-D and SDO-E for males and females
bys sex: summ sdo_d sdo_e


*Rightwing Authoritarianism (large value = higher in RWA)
pwcorr q2_1 q2_2 q2_3 q2_4 q2_5 q2_6 q2_7 q2_8, sig
recode q2_1 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q2_2 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q2_6 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q2_7 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
alpha q2_1 q2_2 q2_3 q2_4 q2_5 q2_6 q2_7 q2_8

egen RWA = rowmean(q2_1 q2_2 q2_3 q2_4 q2_5 q2_6 q2_7 q2_8)

* Recodes to a 0-1 scale for observed min and max within males and females
summ RWA if sex == 1
generate rwa = (RWA-(r(min)))/(r(max)-r(min)) if sex == 1

summ RWA if sex == 2
replace rwa = (RWA-(r(min)))/(r(max)-r(min)) if sex == 2


*Descriptives for males and females separately
alpha q2_1 q2_2 q2_3 q2_4 q2_5 q2_6 q2_7 q2_8
bys sex: summ rwa


** Drive For Muscularity: Recoded to a 0-1 scale for observed min and max within males and females, respectively:
pwcorr q3_1 q3_2 q3_3 q3_4 q3_5 q3_6 q3_7 q3_8, sig
alpha q3_1 q3_2 q3_3 q3_4 q3_5 q3_6 q3_7 q3_8
egen DFM = rowmean(q3_1 q3_2 q3_3 q3_4 q3_5 q3_6 q3_7 q3_8)

summ DFM if sex == 1
generate dfm = (DFM-(r(min)))/(r(max)-r(min)) if sex == 1

summ DFM if sex == 2
replace dfm = (DFM-(r(min)))/(r(max)-r(min)) if sex == 2

*Descriptives for Drive for Muscularity for males and females separately:
alpha q3_1 q3_2 q3_3 q3_4 q3_5 q3_6 q3_7 q3_8
bys sex: summ dfm 


** Perceived living conditions
* Childhood living conditions
pwcorr q7a_1 q7a_2 q7a_3, sig
alpha q7a_1 q7a_2 q7a_3
egen condition_child = rowmean(q7a_1 q7a_2 q7a_3)
generate cond_child = (condition_child-1)/6
bys sex: summ cond_child


* Present living conditions
pwcorr q7b_1 q7b_2 q7b_3, sig
alpha q7b_1 q7b_2 q7b_3
egen condition_now = rowmean(q7b_1 q7b_2 q7b_3)
generate cond_now = (condition_now-1)/6
bys sex: summ cond_now



*--------------------------------------------------- DESCRIPTIVES ---------------------------------------------------------*
* Age
summ age

* Sex
tab sex

* Drive for Muscularity
alpha q3_1 q3_2 q3_3 q3_4 q3_5 q3_6 q3_7 q3_8
bys sex: summ dfm

* Social Dominance Orientation
alpha q1_1 q1_2 q1_3 q1_4 q1_5 q1_6 q1_7 q1_8
bys sex: summ sdo

* Rightwing Authoritarianism
alpha q2_1 q2_2 q2_3 q2_4 q2_5 q2_6 q2_7 q2_8
bys sex: summ rwa


*----------------------------Analyses: Drive for Muscularity --> Social Dominance Orientation-----------------------------*

*** DFM on for females
reg sdo c.dfm c.education c.age if sex == 1

*** DFM på SDO for males
reg sdo c.dfm c.education c.age if sex == 2


*------------------------------------ Analyses for SDO-D and SDO-E separately --------------------------------------------*

* Females: DFM on SDO-D
reg sdo_d c.dfm c.education c.age if sex == 1

* Males: DFM on SDO-D
reg sdo_d c.dfm c.education c.age if sex == 2

* Females: DFM on SDO-E
reg sdo_e c.dfm c.education c.age if sex == 1

* Males: DFM on SDO-E
reg sdo_e c.dfm c.education c.age if sex == 2


*------------------------- Analyses: Drive for Muscularity --> Rightwing Authoritarianism -------------------------------*

* Females: DFM on RWA
reg rwa c.dfm c.education c.age if sex == 1
eststo Model1

* Males: DFM on RWA
reg rwa c.dfm c.education c.age if sex == 2



*------------- Interactive relationships between Drive for Muscularity and current living conditions ------------------*
*** Current living conditions as moderator
* Females
reg sdo c.dfm##c.cond_now c.education c.age if sex == 1

margins, dydx(dfm) at(cond_now=(0 (0.05) 1.0))
marginsplot, recastci(rline) ciopts(lpattern(dash)) recast(line) yline(0) xlabel(#10) ///
xtitle(Socio-Economic Status) ytitle(Marg. effect of formidability) title("") scheme(s2mono)

* Males
reg sdo c.dfm##c.cond_now c.education c.age if sex == 2

margins, dydx(dfm) at(cond_now=(0 (0.05) 1.0))
marginsplot, recastci(rline) ciopts(lpattern(dash)) recast(line) yline(0) xlabel(#10) ///
xtitle(Socio-Economic Status) ytitle(Marg. effect of formidability) title("") scheme(s2mono)
